<!---
    Title:      EPAR1.1 
    Author:     Bruce Frick
    Purpose:    index page
--->

<cfset BASE = CreateObject("component", "#session.rootDir#.cfc.base") />
<cfset mainQueries = CreateObject("component", "#session.rootDir#.cfc.queries") />
<cfinclude template="/code_lib/SCF_Employee.cfm">
<cfinclude template="/code_lib/SCF_HR.cfm">
<cfinclude template="/code_lib/SCF_REGEX.cfm">
<cfoutput>
<!---HTML header, css links, js links, and page title--->
#BASE.htmlTerminationHeader(
    "/jquery/ui-1.8.5/jquery-ui.min.js,../js/Step2-HRAcknowledgeRequest3.js", <!---JS links--->
    "/jquery/ui-1.8.5/themes/cupertino/jquery-ui.css", <!---CSS links--->
    "Step 2:  HR - Confirmation Request 3", <!---Page Title--->
    "Status" <!---Active Nav Link--->
)#
<!---HTML header, css links, js links, and page title--->

<cfif Session.bolAuth EQ True and (Session.strAuthType EQ Session.MANAGERS or Session.strAuthType EQ Session.IT or Session.strAuthType EQ Session.HR)>
    
    <cfset LOCALS = {} />

    <cfif isdefined("Session.TermReqID")>
        <cfset LOCALS.TermReqID = Session.TermReqID>
    <cfelse>
        <cflocation url="Step2-HRAcknowledgeRequest1.cfm" addtoken="no" >
    </cfif>
    
    <cfset QUERIES = {
        GetTermDetails = CreateObject("component", "#session.rootDir#.cfc.queries").funcGetTermDetails(LOCALS.TermReqID, 18),
        GetFilePath = CreateObject("component", "#session.rootDir#.cfc.queries").funcGetFilePath(),
        GetAllEmployees = CreateObject("component", "#session.rootDir#.cfc.queries").funcGetAllEmployees(),
        GetTermTypes = CreateObject("component", "#session.rootDir#.cfc.queries").funcGetPersonCodes('TT'),
        GetES = CreateObject("component", "#session.rootDir#.cfc.queries").funcGetPersonCodes('ES'),
        GetRC = CreateObject("component", "#session.rootDir#.cfc.queries").funcGetReasonCodes('ES'),
        GetFileTypes = CreateObject("component", "#session.rootDir#.cfc.queries").funcGetFileTypes(2),
        GetFiles = CreateObject("component", "#session.rootDir#.cfc.queries").funcGetFiles(LOCALS.TermReqID),
        GetFilePath = CreateObject("component", "#session.rootDir#.cfc.queries").funcGetFilePath()
    } />

    <cfquery name="QUERIES.GetEmpStatus" dbtype="query">
        Select * 
        From QUERIES.GetES
        Where PersonCodeIDNo in (-10133, -10132)
    </cfquery>    
    
    <cfquery name="QUERIES.GetESReasonCodes" dbtype="query">
        Select * 
        From QUERIES.GetRC
        Where ReasonCodeIDNo not in (3,5,6,56)
    </cfquery>
    
    <h1 class="title">Step 2:  HR - Termination Acknowledge</h1>
    <div class="entry">    
         Welcome, #Session.arrEmpInfo.FirstName# #Session.arrEmpInfo.LastName#.  
         In this step, you'll verify the termination information submitted by 
         the manager: 
         <br /><br />
                         
        <cfform id="frmUpload" name="frmUpload" method='POST' enctype='multipart/form-data'>
            <table width = 100%>
                <tr>
                    <td width =20%>Submitted By:</td>
                    <td>
                        #SCF_EMPLOYEE_GetEmployee(QUERIES.GetTermDetails.ActionByID).FullName#
                        <cfinput type="hidden" name="ManagerName"  value="#SCF_EMPLOYEE_GetEmployee(QUERIES.GetTermDetails.ActionByID).FullName#"/>
                    </td>
                </tr>
                <tr>
                    <td width =20%>Submitted Date/Time:</td>
                    <td>
                        #dateformat(QUERIES.GetTermDetails.ActTimeStamp,'mm/dd/yyyy') & ' ' & timeformat(QUERIES.GetTermDetails.ActTimeStamp,'H:MM:ss TT')#
                        <cfinput type="hidden" name="DateSubmitted" value="#dateformat(QUERIES.GetTermDetails.ActTimeStamp,'mm/dd/yyyy') & ' ' & timeformat(QUERIES.GetTermDetails.ActTimeStamp,'H:MM:ss TT')#"/>
                    </td>
                </tr>
                <tr>
                    <td width =20% valign="top">Comments:</td>
                    <td>
                        #QUERIES.GetTermDetails.Notes#
                        <cfinput type="hidden" name="ManagerComments" value="#QUERIES.GetTermDetails.Notes#"/>
                    </td>
                </tr>
                <tr>
                    <td colspan=2>
                        <HR />
                    </td>
                </tr>
                <tr>
                    <td width =20%>Employee:</td>
                    <td>
                        #SCF_EMPLOYEE_GetEmployee(QUERIES.GetTermDetails.RosettaID).FullName#
                        <cfinput type="hidden" name="RosettaID" value="#QUERIES.GetTermDetails.RosettaID#"/>
                    </td>
                </tr>
                <tr>
                    <td>Termination Type:</td>
                    <td>
                        <cfquery name="QUERIES.GetTermType" dbtype="query">
                            Select PersonCode
                            From QUERIES.GetTermTypes 
                            Where PersonCodeIDNo = #QUERIES.GetTermDetails.TermTypeID#
                        </cfquery>                          
                        #QUERIES.GetTermType.PersonCode#
                    </td>
                </tr>
                <tr>
                    <td>Employee Status:</td>
                    <td>     
                        <cfquery name="QUERIES.GetEmpStat" dbtype="query">
                            Select PersonCode
                            From QUERIES.GetEmpStatus
                            Where PersonCodeIDNo = #QUERIES.GetTermDetails.EmpStatusIDNo#
                        </cfquery>                      
                        #QUERIES.GetEmpStat.PersonCode#
                    </td>
                </tr>
                <tr>
                    <td nowrap="nowrap">Employment Status Reason:</td>
                    <td> 
                        <cfquery name="QUERIES.GetESReasonCode" dbtype="query">
                            Select ReasonCode
                            From QUERIES.GetESReasonCodes
                            Where ReasonCodeIDNo = #QUERIES.GetTermDetails.EmpStatusReasonCode#
                        </cfquery>                          
                        #QUERIES.GetESReasonCode.ReasonCode#                         
                    </td>
                </tr>
                <tr>
                    <td>Rehire Eligible?</td>
                    <td>
                        <cfif QUERIES.GetTermDetails.RehireElig EQ 1>
                            YES
                        <cfelse>
                            NO
                        </cfif>
                    </td>
                </tr>
                <tr>
                    <td valign="top">Effective Termination Date:</td>
                    <td>
                        #dateformat(QUERIES.GetTermDetails.TermDate, 'mm/dd/yyyy')#
                    </td>
                </tr>
                <tr>
                    <td valign="top">HR Termination Date:</td>
                    <td>
                        #dateformat(QUERIES.GetTermDetails.SysTermDate, 'mm/dd/yyyy')#
                    </td>
                </tr>
                <tr>
                    <td valign="top">
                        COBRA Notify Date:
                    </td>
                    <td>
                        #dateformat(QUERIES.GetTermDetails.COBRAEndOfMonth, 'mm/dd/yyyy')#
                    </td>
                </tr>
                <tr>
                    <td colspan = 2>
                        <fieldset>
                        <legend>File Library</legend>
                        <table width=100%>
                            <TR>
                                <TD width=5% nowrap="nowrap" valign="top">
                                    File Type:
                                </TD>
                                <TD width="75%">
                                    <cfselect name="FileTypeID" query="QUERIES.GetFileTypes" display="Name" value="ID"/>                                    
                                </TD>
                                <TD>&nbsp;</TD>
                            </TR>
                            <TR>
                                <TD width=5% nowrap="nowrap" valign="top">
                                    File:
                                </TD>
                                <TD width="75%">
                                    <cfinput type="file" name="FileUpload" required="yes" message="Please specify the file to upload." style="width:100%">                                      
                                </TD>
                                <TD align="right" valign="bottom">
                                    <cfinput name="Upload" type="button" value="Upload"> 
                                </TD>
                            </TR>   
                            <tr>
                                <td colspan=3>
                                    <HR />
                                </td>
                            </tr>   
                            <TR>
                                <TD colspan=3>
                                    <table width="100%">
                                        <TR>
                                            <TD rowspan="4" colspan=3 valign="top">
                                            <cfif QUERIES.GetFiles.recordcount EQ 0>
                                                <span class="failed" style="font-size:90%">No existing files associated with this termination request</span>
                                            <cfelse>
                                                <Table width=100%>
                                                    <TR>
                                                        <TD>
                                                            <strong>File Type</strong>
                                                        </TD>
                                                        <TD width=1%>&nbsp;</TD>
                                                        <TD>
                                                            <strong>Date Submitted</strong>
                                                        </TD>
                                                        <TD width=1%>&nbsp;</TD>
                                                        <TD>
                                                            <strong>Submitted By</strong>
                                                        </TD>
                                                        <TD width=1%>&nbsp;</TD>
                                                        <TD>
                                                            <strong>File Name</strong>
                                                        </TD>
                                                    </TR>
                                                <cfloop query="QUERIES.GetFiles">
                                                    <!--- <cfset Path = QUERIES.GetFilePath.Directory & "\" & QUERIES.GetFiles.FileName> --->
                                                    <cfset Path = "/#session.rootDir#/Termination/Documents/" & QUERIES.GetFiles.FileName />
                                                    <cfset LOCALS.LoadedBy = SCF_Employee_GetEmployee(QUERIES.GetFiles.LoadedBy).FullName>
                                                    <TR>
                                                        <TD nowrap="nowrap">
                                                            #QUERIES.GetFiles.Name#
                                                        </TD>
                                                        <TD>&nbsp;</TD>
                                                        <TD nowrap="nowrap">
                                                            #dateformat(QUERIES.GetFiles.DateLoaded, 'm/d/yyyy')#
                                                        </TD>
                                                        <TD>&nbsp;</TD>
                                                        <TD nowrap="nowrap">
                                                            #LOCALS.LoadedBy#
                                                        </TD>
                                                        <TD>&nbsp;</TD>
                                                        <TD nowrap="nowrap">                                        
                                                            <a href="#Path#" target="_blank">#QUERIES.GetFiles.FileName#</a>
                                                        </TD
                                                        >
                                                    </TR>
                                                </cfloop>
                                                </Table>
                                            </cfif>     
                                            </TD>
                                        </TR>
                                    </table>
                                </TD>
                            </TR>                       
                        </table>    
                        </fieldset>                 
                    </td>
                </tr>
            </table>
            
            <cfinput type="hidden" name="TermReqID" value="#LOCALS.TermReqID#" />
            <cfinput type="hidden" name="Directory" value="#QUERIES.GetFilePath.Directory#" />
            
            </cfform>
            
            <cfform id="frmFinal" name="frmFinal" method='POST' enctype='multipart/form-data'>
            <table width="100%">
                <tr>
                    <td width="100%">
                        Final Comments:
                    </td>
                </tr> 
                <tr>
                    <td align="right" width="100%">
                        <cftextarea name="Comments" value="#QUERIES.GetTermDetails.Notes#" style="width:100%"/>
                    </td>
                </tr>  
                <tr>
                    <td  align="right">
                        <cfinput type="hidden" name="TermReqID" value="#LOCALS.TermReqID#" />
                        <cfinput type="button" name="Back" value="<< Back" tabindex="75" >
                        <cfinput type="button" name="Finish" value="Finish (Terminate)" tabindex="80">
                    </td>
                </tr>  
            </table>
            </cfform>
    
    </div>

<cfelse>
    <cfinclude template="../denied.cfm">
</cfif>


<!---HTML footer, closes html and body tags.  Any footer info goes here--->
#BASE.htmlTerminationFooter()#
<!---HTML footer, closes html and body tags.  Any footer info goes here--->
</cfoutput>